package de.ff7rl.core.gamestate;

import de.ff7rl.core.Game;

public abstract class AbstractGameStateController implements GameStateController {

  private Game game;
  private GameState nextGameState;
  private GameState previousGameState;

  @Override
  public void enter(final GameState thePreviousGameState, final Object... theArguments) {
    previousGameState = thePreviousGameState;
    game().getTerminal().clear();
  }

  @Override
  public void initialize(final Game theGameImpl) {
    game = theGameImpl;
  }

  @Override
  public void leave(final GameState theNextGameState) {
    nextGameState = theNextGameState;
  }

  protected Game game() {
    return game;
  }

  protected GameState nextGameState() {
    return nextGameState;
  }

  protected GameState previousGameState() {
    return previousGameState;
  }

}
